**CREATE USAGE RATE DATA **

/* Source data for CPS usage rates is from Dettling (2016) ILRR paper, kept only relevant variables from full data set used in those analyses 
PEW data is can be downloaded from their website

last update: Oct 4 2016 */



cd $datafolder 

***construct a set of HSI usage rates by metro status and year**
use "cps_extract_adults.dta", clear

collapse hsi_home, by(year msadweller)

**each month=0.083 on a 10 pt scale, so jan=0, feb=0.083...(e.g, (month-1)*0.0833)
**generate a new 
gen year_qtr=year+0.750
replace year_qtr=year+0.583 if year==2000
replace year_qtr=year+0.664 if year==2001

save "hsi_use_byurban.dta"



***construct a set of HSI usage rates by year**
use "cps_extract_adults.dta", clear

collapse hsi_home, by(year)

**each month=0.083 on a 10 pt scale, so jan=0, feb=0.083...(e.g, (month-1)*0.0833)
**generate a new 
gen year_qtr=year+0.750
replace year_qtr=year+0.583 if year==2000
replace year_qtr=year+0.664 if year==2001

save "hsi_use_cps.dta"


**PEW DATA**
**this is just a dta version of a direct download from their website, 9-2-2014
** hsi_use_pew.dta

